package com.yanqu.road.server.manger.activity.curio.condition;

import com.yanqu.road.entity.enums.ePlayerAttrType;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.player.AttributeModule;

import java.util.List;

/**
 * 玩家属性值-条件
 */
public class PlayerAttrValueCondition extends BaseCurioSpecialCondition {

    private ePlayerAttrType playerAttrType;

    public PlayerAttrValueCondition(GamePlayer player, ePlayerAttrType playerAttrType) {
        super(player);
        this.playerAttrType = playerAttrType;
    }

    @Override
    public boolean isCompleted(List<Integer> params) {
        return getConditionValue(params) >= params.get(0);
    }

    @Override
    public long getConditionValue(List<Integer> params) {
        return player.getModule(AttributeModule.class).getAttribute(playerAttrType);
    }
}
